package com.j180.bean;

import org.springframework.beans.factory.annotation.Autowired;

public class Person {

    private Integer id;

    private String name;
    //自动装配(默认是byType)
   // @Autowired
    private Dog dog1;

    public Person() {
    }

    private Person(Dog dog){

        this.dog1=dog;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public Dog getDog() {
        return dog1;
    }

    public void setDog1(Dog dog) {
        System.out.println("setDog");
        this.dog1 = dog;
    }

   /* @Override
    public String toString() {
        return "Person{" +
                "id=" + id +
                ", name='" + name + '\'' +
                ", dog=" + dog1 +
                '}';
    }*/
}
